const ModelInfo = require("../models/Model");
const DEFAULT_MODEL = {
  model: "A30",
};
function syncModel() {
  try {
    console.log("Default model", DEFAULT_MODEL);
    ModelInfo.findAll()
      .then((model) => {
        console.log("model ", model);
        if (model && model.length > 0) {
          console.log("model.length > 0");
        } else {
          // 版本不存在，创建默认版本
          return ModelInfo.create(DEFAULT_MODEL);
        }
      })
      .then((result) => {
        if (result) {
          console.log("Default model created");
        }
      })
      .catch((err) => {
        console.error("Error handling default user:", err);
      });
  } catch (error) {
    console.log("syncModel error", error);
  }
}
module.exports = {
  syncModel,
};
